class Solution:
    def lengthofLongestSubstring(self,s:str) -> int:
        occ=set()
        n=len(s)
        rk=-1
        ans=0
        startIndex=0
        if n==0:
            return 0
        for i in range(n):
            while rk+1<n and s[rk+1] not in occ:
                occ.add(s[rk+1])
                rk+=1
            ans=max(ans,rk-startIndex+1)
            if rk+1<n:
                startIndex+=1
                rk=startIndex+1
        return ans
s=Solution()
print("长度为：",s.lengthofLongestSubstring("a123456abcdefghijklmn"))

                
        